{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 87,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Unnamed: 0</th>\n",
       "      <th>date</th>\n",
       "      <th>open</th>\n",
       "      <th>pred</th>\n",
       "      <th>pred_result</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>2019-02-25</td>\n",
       "      <td>6.18</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>2019-02-26</td>\n",
       "      <td>6.23</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2</td>\n",
       "      <td>2019-02-27</td>\n",
       "      <td>6.08</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>3</td>\n",
       "      <td>2019-02-28</td>\n",
       "      <td>6.57</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4</td>\n",
       "      <td>2019-03-01</td>\n",
       "      <td>6.50</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>605</th>\n",
       "      <td>605</td>\n",
       "      <td>2021-08-17</td>\n",
       "      <td>4.20</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>606</th>\n",
       "      <td>606</td>\n",
       "      <td>2021-08-18</td>\n",
       "      <td>4.16</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>607</th>\n",
       "      <td>607</td>\n",
       "      <td>2021-08-19</td>\n",
       "      <td>4.23</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>608</th>\n",
       "      <td>608</td>\n",
       "      <td>2021-08-20</td>\n",
       "      <td>4.29</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>609</th>\n",
       "      <td>609</td>\n",
       "      <td>2021-08-23</td>\n",
       "      <td>4.15</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>610 rows × 5 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     Unnamed: 0        date  open  pred  pred_result\n",
       "0             0  2019-02-25  6.18   NaN            0\n",
       "1             1  2019-02-26  6.23   0.0            0\n",
       "2             2  2019-02-27  6.08   NaN            0\n",
       "3             3  2019-02-28  6.57   NaN            0\n",
       "4             4  2019-03-01  6.50   NaN            0\n",
       "..          ...         ...   ...   ...          ...\n",
       "605         605  2021-08-17  4.20   2.0            0\n",
       "606         606  2021-08-18  4.16   2.0            1\n",
       "607         607  2021-08-19  4.23   2.0            1\n",
       "608         608  2021-08-20  4.29   2.0            0\n",
       "609         609  2021-08-23  4.15   2.0            0\n",
       "\n",
       "[610 rows x 5 columns]"
      ]
     },
     "execution_count": 87,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data=pd.read_csv(\"data_need1.csv\")\n",
    "data.loc[1,'pred']=0\n",
    "data['pred_result']=0\n",
    "for i in range(51,608):\n",
    "    if data.loc[i+1,'open']-data.loc[i,'open']>0:\n",
    "        data.loc[i,'pred_result']=1\n",
    "    else:\n",
    "        data.loc[i,'pred_result']=0\n",
    "data\n",
    "\n",
    "def function1(a,b,c):\n",
    "    sum=b-a\n",
    "    if c in [0,1,2]and sum>=0:\n",
    "        return 0\n",
    "    elif c in [0,1,2]and sum<0:\n",
    "        return 1\n",
    "    elif c in [3,4,5]and sum>=0:\n",
    "        return 1\n",
    "    elif c in [3,4,5] and sum<0:\n",
    "        return 0\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "<ipython-input-24-9c850aed7e5e>:5: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame\n",
      "\n",
      "See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  data.iloc[i]['result']=int(0)\n",
      "<ipython-input-24-9c850aed7e5e>:7: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame\n",
      "\n",
      "See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  data.iloc[i]['result']=int(1)\n",
      "<ipython-input-24-9c850aed7e5e>:9: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame\n",
      "\n",
      "See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
      "  data.iloc[i]['result']=int(-1)\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Unnamed: 0</th>\n",
       "      <th>代号</th>\n",
       "      <th>时间</th>\n",
       "      <th>链接</th>\n",
       "      <th>标题</th>\n",
       "      <th>内容</th>\n",
       "      <th>结果</th>\n",
       "      <th>和值</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>688148</td>\n",
       "      <td>2021-08-14 08:13:56</td>\n",
       "      <td>http://stock.eastmoney.com/a/20210814204624987...</td>\n",
       "      <td>芳源股份：融资净偿还4358.35万元，融资余额1.73亿元（08-13）</td>\n",
       "      <td>\\r\\n\\r\\n芳源股份融资融券信息显示，2021年8月13日融资净偿还4358.35万元；...</td>\n",
       "      <td>[1]</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>688148</td>\n",
       "      <td>2021-08-13 11:37:42</td>\n",
       "      <td>http://finance.eastmoney.com/a/202108132044861...</td>\n",
       "      <td>江企上市奉献“帽子戏法”</td>\n",
       "      <td>8月份江门资本市场建设“梅开二度”！8月11日，广东绿岛风空气系统股份有限公司(简称“绿岛风...</td>\n",
       "      <td>[1]</td>\n",
       "      <td>155</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2</td>\n",
       "      <td>688148</td>\n",
       "      <td>2021-08-13 08:12:17</td>\n",
       "      <td>http://stock.eastmoney.com/a/20210813204421307...</td>\n",
       "      <td>芳源股份：融资余额环比下降13.54%，降幅两市第12（08-12）</td>\n",
       "      <td>\\r\\n\\r\\n芳源股份融资融券信息显示，2021年8月12日融资净偿还3391.37万元；...</td>\n",
       "      <td>[1]</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>3</td>\n",
       "      <td>688148</td>\n",
       "      <td>2021-08-12 08:19:15</td>\n",
       "      <td>http://finance.eastmoney.com/a/202108122042216...</td>\n",
       "      <td>我市3项目入围半决赛</td>\n",
       "      <td>○本报讯记者王亚娇通讯员周珊珊近日，广东省首届农村创业创新大赛评审会举行。经过专家评审，结合...</td>\n",
       "      <td>[1]</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4</td>\n",
       "      <td>688148</td>\n",
       "      <td>2021-08-12 08:08:13</td>\n",
       "      <td>http://stock.eastmoney.com/a/20210812204216342...</td>\n",
       "      <td>芳源股份：融资净买入321.2万元，融资余额2.51亿元（08-11）</td>\n",
       "      <td>\\r\\n\\r\\n芳源股份融资融券信息显示，2021年8月11日融资净买入321.2万元；融资...</td>\n",
       "      <td>[1]</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95</th>\n",
       "      <td>95</td>\n",
       "      <td>688148</td>\n",
       "      <td>2021-01-03 08:55:59</td>\n",
       "      <td>http://finance.eastmoney.com/a/202101031759388...</td>\n",
       "      <td>IPO周报：受理增速！2020年IPO收官 广州农商行等三公司遗憾错过“末班车”</td>\n",
       "      <td>本周(12月28日-12月31日)关于IPO市场动态如下：\\r\\n本周共计审核IPO公司18...</td>\n",
       "      <td>[-1]</td>\n",
       "      <td>204</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>96</th>\n",
       "      <td>96</td>\n",
       "      <td>688148</td>\n",
       "      <td>2021-01-01 07:01:53</td>\n",
       "      <td>http://finance.eastmoney.com/a/202101011758843...</td>\n",
       "      <td>全球20多家巨头规划投资超2000亿元 锂电全产业链备战TWh时代</td>\n",
       "      <td>“未来几年都不愁销路啊，就怕产能不够。”2020年12月30日，湖北云梦经济开发区，中一科技...</td>\n",
       "      <td>[-1]</td>\n",
       "      <td>69</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>97</td>\n",
       "      <td>688148</td>\n",
       "      <td>2020-12-31 14:45:19</td>\n",
       "      <td>http://stock.eastmoney.com/a/20201231175830982...</td>\n",
       "      <td>芳源股份原材料关联采购价格低于同业 技术线路存在风险</td>\n",
       "      <td>广东芳源环保股份有限公司的主要产品为高端电动汽车用NCA三元正极材料前驱体，具有国内领先的高...</td>\n",
       "      <td>[-1]</td>\n",
       "      <td>39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>98</td>\n",
       "      <td>688148</td>\n",
       "      <td>2020-12-31 13:04:52</td>\n",
       "      <td>http://finance.eastmoney.com/a/202012311758141...</td>\n",
       "      <td>博众精工：今年科创板过会第215家 华泰联合过22单</td>\n",
       "      <td>科创板上市委2020年第127次审议会议于昨日上午召开，审议结果显示，博众精工科技股份有限公...</td>\n",
       "      <td>[1]</td>\n",
       "      <td>68</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>99</td>\n",
       "      <td>688148</td>\n",
       "      <td>2020-12-31 13:04:25</td>\n",
       "      <td>http://finance.eastmoney.com/a/202012311758141...</td>\n",
       "      <td>英科环保：今年科创板过会第216家 国金证券过5单</td>\n",
       "      <td>科创板上市委2020年第127次审议会议于昨日上午召开，审议结果显示，山东英科环保再生资源股...</td>\n",
       "      <td>[1]</td>\n",
       "      <td>16</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>100 rows × 8 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "    Unnamed: 0      代号                   时间  \\\n",
       "0            0  688148  2021-08-14 08:13:56   \n",
       "1            1  688148  2021-08-13 11:37:42   \n",
       "2            2  688148  2021-08-13 08:12:17   \n",
       "3            3  688148  2021-08-12 08:19:15   \n",
       "4            4  688148  2021-08-12 08:08:13   \n",
       "..         ...     ...                  ...   \n",
       "95          95  688148  2021-01-03 08:55:59   \n",
       "96          96  688148  2021-01-01 07:01:53   \n",
       "97          97  688148  2020-12-31 14:45:19   \n",
       "98          98  688148  2020-12-31 13:04:52   \n",
       "99          99  688148  2020-12-31 13:04:25   \n",
       "\n",
       "                                                   链接  \\\n",
       "0   http://stock.eastmoney.com/a/20210814204624987...   \n",
       "1   http://finance.eastmoney.com/a/202108132044861...   \n",
       "2   http://stock.eastmoney.com/a/20210813204421307...   \n",
       "3   http://finance.eastmoney.com/a/202108122042216...   \n",
       "4   http://stock.eastmoney.com/a/20210812204216342...   \n",
       "..                                                ...   \n",
       "95  http://finance.eastmoney.com/a/202101031759388...   \n",
       "96  http://finance.eastmoney.com/a/202101011758843...   \n",
       "97  http://stock.eastmoney.com/a/20201231175830982...   \n",
       "98  http://finance.eastmoney.com/a/202012311758141...   \n",
       "99  http://finance.eastmoney.com/a/202012311758141...   \n",
       "\n",
       "                                          标题  \\\n",
       "0      芳源股份：融资净偿还4358.35万元，融资余额1.73亿元（08-13）   \n",
       "1                               江企上市奉献“帽子戏法”   \n",
       "2         芳源股份：融资余额环比下降13.54%，降幅两市第12（08-12）   \n",
       "3                                 我市3项目入围半决赛   \n",
       "4        芳源股份：融资净买入321.2万元，融资余额2.51亿元（08-11）   \n",
       "..                                       ...   \n",
       "95  IPO周报：受理增速！2020年IPO收官 广州农商行等三公司遗憾错过“末班车”   \n",
       "96         全球20多家巨头规划投资超2000亿元 锂电全产业链备战TWh时代   \n",
       "97                芳源股份原材料关联采购价格低于同业 技术线路存在风险   \n",
       "98                博众精工：今年科创板过会第215家 华泰联合过22单   \n",
       "99                 英科环保：今年科创板过会第216家 国金证券过5单   \n",
       "\n",
       "                                                   内容    结果   和值  \n",
       "0   \\r\\n\\r\\n芳源股份融资融券信息显示，2021年8月13日融资净偿还4358.35万元；...   [1]    4  \n",
       "1   8月份江门资本市场建设“梅开二度”！8月11日，广东绿岛风空气系统股份有限公司(简称“绿岛风...   [1]  155  \n",
       "2   \\r\\n\\r\\n芳源股份融资融券信息显示，2021年8月12日融资净偿还3391.37万元；...   [1]    4  \n",
       "3   ○本报讯记者王亚娇通讯员周珊珊近日，广东省首届农村创业创新大赛评审会举行。经过专家评审，结合...   [1]   15  \n",
       "4   \\r\\n\\r\\n芳源股份融资融券信息显示，2021年8月11日融资净买入321.2万元；融资...   [1]    4  \n",
       "..                                                ...   ...  ...  \n",
       "95  本周(12月28日-12月31日)关于IPO市场动态如下：\\r\\n本周共计审核IPO公司18...  [-1]  204  \n",
       "96  “未来几年都不愁销路啊，就怕产能不够。”2020年12月30日，湖北云梦经济开发区，中一科技...  [-1]   69  \n",
       "97  广东芳源环保股份有限公司的主要产品为高端电动汽车用NCA三元正极材料前驱体，具有国内领先的高...  [-1]   39  \n",
       "98  科创板上市委2020年第127次审议会议于昨日上午召开，审议结果显示，博众精工科技股份有限公...   [1]   68  \n",
       "99  科创板上市委2020年第127次审议会议于昨日上午召开，审议结果显示，山东英科环保再生资源股...   [1]   16  \n",
       "\n",
       "[100 rows x 8 columns]"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "data=pd.read_csv(\"1_st688148.csv\")\n",
    "\n",
    "for i in range(0,100):\n",
    "    data.iloc[i]['result']=int(0)\n",
    "    if(data.iloc[i]['结果'][1]=='1'):\n",
    "        data.iloc[i]['result']=int(1)\n",
    "    else:\n",
    "        data.iloc[i]['result']=int(-1)\n",
    "        \n",
    "data    \n",
    "    #\n",
    "    #data.iloc[i]['结果']=int(data.iloc[i]['结果'][1])\n",
    "    \n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Unnamed: 0</th>\n",
       "      <th>代号</th>\n",
       "      <th>时间</th>\n",
       "      <th>链接</th>\n",
       "      <th>标题</th>\n",
       "      <th>内容</th>\n",
       "      <th>结果</th>\n",
       "      <th>和值</th>\n",
       "      <th>result</th>\n",
       "      <th>(0, result)</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>688148</td>\n",
       "      <td>2021-08-14 08:13:56</td>\n",
       "      <td>http://stock.eastmoney.com/a/20210814204624987...</td>\n",
       "      <td>芳源股份：融资净偿还4358.35万元，融资余额1.73亿元（08-13）</td>\n",
       "      <td>\\r\\n\\r\\n芳源股份融资融券信息显示，2021年8月13日融资净偿还4358.35万元；...</td>\n",
       "      <td>[1]</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1</td>\n",
       "      <td>688148</td>\n",
       "      <td>2021-08-13 11:37:42</td>\n",
       "      <td>http://finance.eastmoney.com/a/202108132044861...</td>\n",
       "      <td>江企上市奉献“帽子戏法”</td>\n",
       "      <td>8月份江门资本市场建设“梅开二度”！8月11日，广东绿岛风空气系统股份有限公司(简称“绿岛风...</td>\n",
       "      <td>[1]</td>\n",
       "      <td>155</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2</td>\n",
       "      <td>688148</td>\n",
       "      <td>2021-08-13 08:12:17</td>\n",
       "      <td>http://stock.eastmoney.com/a/20210813204421307...</td>\n",
       "      <td>芳源股份：融资余额环比下降13.54%，降幅两市第12（08-12）</td>\n",
       "      <td>\\r\\n\\r\\n芳源股份融资融券信息显示，2021年8月12日融资净偿还3391.37万元；...</td>\n",
       "      <td>[1]</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>3</td>\n",
       "      <td>688148</td>\n",
       "      <td>2021-08-12 08:19:15</td>\n",
       "      <td>http://finance.eastmoney.com/a/202108122042216...</td>\n",
       "      <td>我市3项目入围半决赛</td>\n",
       "      <td>○本报讯记者王亚娇通讯员周珊珊近日，广东省首届农村创业创新大赛评审会举行。经过专家评审，结合...</td>\n",
       "      <td>[1]</td>\n",
       "      <td>15</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4</td>\n",
       "      <td>688148</td>\n",
       "      <td>2021-08-12 08:08:13</td>\n",
       "      <td>http://stock.eastmoney.com/a/20210812204216342...</td>\n",
       "      <td>芳源股份：融资净买入321.2万元，融资余额2.51亿元（08-11）</td>\n",
       "      <td>\\r\\n\\r\\n芳源股份融资融券信息显示，2021年8月11日融资净买入321.2万元；融资...</td>\n",
       "      <td>[1]</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>95</th>\n",
       "      <td>95</td>\n",
       "      <td>688148</td>\n",
       "      <td>2021-01-03 08:55:59</td>\n",
       "      <td>http://finance.eastmoney.com/a/202101031759388...</td>\n",
       "      <td>IPO周报：受理增速！2020年IPO收官 广州农商行等三公司遗憾错过“末班车”</td>\n",
       "      <td>本周(12月28日-12月31日)关于IPO市场动态如下：\\r\\n本周共计审核IPO公司18...</td>\n",
       "      <td>[-1]</td>\n",
       "      <td>204</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>96</th>\n",
       "      <td>96</td>\n",
       "      <td>688148</td>\n",
       "      <td>2021-01-01 07:01:53</td>\n",
       "      <td>http://finance.eastmoney.com/a/202101011758843...</td>\n",
       "      <td>全球20多家巨头规划投资超2000亿元 锂电全产业链备战TWh时代</td>\n",
       "      <td>“未来几年都不愁销路啊，就怕产能不够。”2020年12月30日，湖北云梦经济开发区，中一科技...</td>\n",
       "      <td>[-1]</td>\n",
       "      <td>69</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>97</th>\n",
       "      <td>97</td>\n",
       "      <td>688148</td>\n",
       "      <td>2020-12-31 14:45:19</td>\n",
       "      <td>http://stock.eastmoney.com/a/20201231175830982...</td>\n",
       "      <td>芳源股份原材料关联采购价格低于同业 技术线路存在风险</td>\n",
       "      <td>广东芳源环保股份有限公司的主要产品为高端电动汽车用NCA三元正极材料前驱体，具有国内领先的高...</td>\n",
       "      <td>[-1]</td>\n",
       "      <td>39</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>98</th>\n",
       "      <td>98</td>\n",
       "      <td>688148</td>\n",
       "      <td>2020-12-31 13:04:52</td>\n",
       "      <td>http://finance.eastmoney.com/a/202012311758141...</td>\n",
       "      <td>博众精工：今年科创板过会第215家 华泰联合过22单</td>\n",
       "      <td>科创板上市委2020年第127次审议会议于昨日上午召开，审议结果显示，博众精工科技股份有限公...</td>\n",
       "      <td>[1]</td>\n",
       "      <td>68</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>99</th>\n",
       "      <td>99</td>\n",
       "      <td>688148</td>\n",
       "      <td>2020-12-31 13:04:25</td>\n",
       "      <td>http://finance.eastmoney.com/a/202012311758141...</td>\n",
       "      <td>英科环保：今年科创板过会第216家 国金证券过5单</td>\n",
       "      <td>科创板上市委2020年第127次审议会议于昨日上午召开，审议结果显示，山东英科环保再生资源股...</td>\n",
       "      <td>[1]</td>\n",
       "      <td>16</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>100 rows × 10 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "    Unnamed: 0      代号                   时间  \\\n",
       "0            0  688148  2021-08-14 08:13:56   \n",
       "1            1  688148  2021-08-13 11:37:42   \n",
       "2            2  688148  2021-08-13 08:12:17   \n",
       "3            3  688148  2021-08-12 08:19:15   \n",
       "4            4  688148  2021-08-12 08:08:13   \n",
       "..         ...     ...                  ...   \n",
       "95          95  688148  2021-01-03 08:55:59   \n",
       "96          96  688148  2021-01-01 07:01:53   \n",
       "97          97  688148  2020-12-31 14:45:19   \n",
       "98          98  688148  2020-12-31 13:04:52   \n",
       "99          99  688148  2020-12-31 13:04:25   \n",
       "\n",
       "                                                   链接  \\\n",
       "0   http://stock.eastmoney.com/a/20210814204624987...   \n",
       "1   http://finance.eastmoney.com/a/202108132044861...   \n",
       "2   http://stock.eastmoney.com/a/20210813204421307...   \n",
       "3   http://finance.eastmoney.com/a/202108122042216...   \n",
       "4   http://stock.eastmoney.com/a/20210812204216342...   \n",
       "..                                                ...   \n",
       "95  http://finance.eastmoney.com/a/202101031759388...   \n",
       "96  http://finance.eastmoney.com/a/202101011758843...   \n",
       "97  http://stock.eastmoney.com/a/20201231175830982...   \n",
       "98  http://finance.eastmoney.com/a/202012311758141...   \n",
       "99  http://finance.eastmoney.com/a/202012311758141...   \n",
       "\n",
       "                                          标题  \\\n",
       "0      芳源股份：融资净偿还4358.35万元，融资余额1.73亿元（08-13）   \n",
       "1                               江企上市奉献“帽子戏法”   \n",
       "2         芳源股份：融资余额环比下降13.54%，降幅两市第12（08-12）   \n",
       "3                                 我市3项目入围半决赛   \n",
       "4        芳源股份：融资净买入321.2万元，融资余额2.51亿元（08-11）   \n",
       "..                                       ...   \n",
       "95  IPO周报：受理增速！2020年IPO收官 广州农商行等三公司遗憾错过“末班车”   \n",
       "96         全球20多家巨头规划投资超2000亿元 锂电全产业链备战TWh时代   \n",
       "97                芳源股份原材料关联采购价格低于同业 技术线路存在风险   \n",
       "98                博众精工：今年科创板过会第215家 华泰联合过22单   \n",
       "99                 英科环保：今年科创板过会第216家 国金证券过5单   \n",
       "\n",
       "                                                   内容    结果   和值  result  \\\n",
       "0   \\r\\n\\r\\n芳源股份融资融券信息显示，2021年8月13日融资净偿还4358.35万元；...   [1]    4       0   \n",
       "1   8月份江门资本市场建设“梅开二度”！8月11日，广东绿岛风空气系统股份有限公司(简称“绿岛风...   [1]  155       0   \n",
       "2   \\r\\n\\r\\n芳源股份融资融券信息显示，2021年8月12日融资净偿还3391.37万元；...   [1]    4       0   \n",
       "3   ○本报讯记者王亚娇通讯员周珊珊近日，广东省首届农村创业创新大赛评审会举行。经过专家评审，结合...   [1]   15       0   \n",
       "4   \\r\\n\\r\\n芳源股份融资融券信息显示，2021年8月11日融资净买入321.2万元；融资...   [1]    4       0   \n",
       "..                                                ...   ...  ...     ...   \n",
       "95  本周(12月28日-12月31日)关于IPO市场动态如下：\\r\\n本周共计审核IPO公司18...  [-1]  204       0   \n",
       "96  “未来几年都不愁销路啊，就怕产能不够。”2020年12月30日，湖北云梦经济开发区，中一科技...  [-1]   69       0   \n",
       "97  广东芳源环保股份有限公司的主要产品为高端电动汽车用NCA三元正极材料前驱体，具有国内领先的高...  [-1]   39       0   \n",
       "98  科创板上市委2020年第127次审议会议于昨日上午召开，审议结果显示，博众精工科技股份有限公...   [1]   68       0   \n",
       "99  科创板上市委2020年第127次审议会议于昨日上午召开，审议结果显示，山东英科环保再生资源股...   [1]   16       0   \n",
       "\n",
       "    (0, result)  \n",
       "0             1  \n",
       "1             1  \n",
       "2             1  \n",
       "3             1  \n",
       "4             1  \n",
       "..          ...  \n",
       "95            1  \n",
       "96            1  \n",
       "97            1  \n",
       "98            1  \n",
       "99            1  \n",
       "\n",
       "[100 rows x 10 columns]"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data['result']=0\n",
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "ename": "AttributeError",
     "evalue": "'DataFrame' object has no attribute 'drip'",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mAttributeError\u001b[0m                            Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-37-aa45eb273a94>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m      1\u001b[0m \u001b[0mdata\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m'result'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 2\u001b[0;31m \u001b[0mdata\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdrip\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcolumns\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[0;32m/usr/lib/python3/dist-packages/pandas/core/generic.py\u001b[0m in \u001b[0;36m__getattr__\u001b[0;34m(self, name)\u001b[0m\n\u001b[1;32m   5177\u001b[0m             \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_info_axis\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_can_hold_identifiers_and_holds_name\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mname\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   5178\u001b[0m                 \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mname\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 5179\u001b[0;31m             \u001b[0;32mreturn\u001b[0m \u001b[0mobject\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__getattribute__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mname\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m   5180\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m   5181\u001b[0m     \u001b[0;32mdef\u001b[0m \u001b[0m__setattr__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mname\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvalue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mAttributeError\u001b[0m: 'DataFrame' object has no attribute 'drip'"
     ]
    }
   ],
   "source": [
    "data[0,'result']=1\n",
    "data.drip(data.columns[-2:])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [],
   "source": [
    "type(data.loc[1,6])\n",
    "data.loc[1,6]\n",
    "for i in data['结果']:\n",
    "    if i[1]==1:\n",
    "        i=int(1)\n",
    "    else:\n",
    "        i=int(-1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 82,
   "metadata": {},
   "outputs": [],
   "source": [
    "#data.loc[1,'结果']=1\n",
    "data\n",
    "for i in range(0,100):\n",
    "    if(data.loc[i,'结果'][1]=='1'):\n",
    "        data.loc[i,'结果']=int(1)\n",
    "    else:\n",
    "        data.loc[i,'结果']=int(-1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 84,
   "metadata": {},
   "outputs": [],
   "source": [
    "data.to_csv(\"result.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "data=pd.read_csv(\"result.csv\")\n",
    "time=[]\n",
    "for i in data['时间']:\n",
    "    if i[:9] not in time:\n",
    "        time.append(i[:9])\n",
    "    else:\n",
    "        pass"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['2021-08-1',\n",
       " '2021-08-0',\n",
       " '2021-07-3',\n",
       " '2021-07-2',\n",
       " '2021-07-1',\n",
       " '2021-07-0',\n",
       " '2021-06-1',\n",
       " '2021-06-0',\n",
       " '2021-05-2',\n",
       " '2021-05-1',\n",
       " '2021-04-0',\n",
       " '2021-03-2',\n",
       " '2021-03-1',\n",
       " '2021-03-0',\n",
       " '2021-02-2',\n",
       " '2021-02-0',\n",
       " '2021-01-2',\n",
       " '2021-01-0',\n",
       " '2020-12-3']"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "False\n"
     ]
    }
   ],
   "source": [
    "data2=pd.read_csv(\"pd600050.csv\")\n",
    "cuseor=0\n",
    "print(time[0]>'2021-08-15')\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>date</th>\n",
       "      <th>sum</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2021-08-1</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2021-08-0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2021-07-3</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2021-07-2</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2021-07-1</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>2021-07-0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>2021-06-1</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>2021-06-0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>2021-05-2</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>2021-05-1</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>2021-04-0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>2021-03-2</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>2021-03-1</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>2021-03-0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>2021-02-2</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>2021-02-0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>2021-01-2</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>2021-01-0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>2020-12-3</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         date  sum\n",
       "0   2021-08-1  NaN\n",
       "1   2021-08-0  NaN\n",
       "2   2021-07-3  NaN\n",
       "3   2021-07-2  NaN\n",
       "4   2021-07-1  NaN\n",
       "5   2021-07-0  NaN\n",
       "6   2021-06-1  NaN\n",
       "7   2021-06-0  NaN\n",
       "8   2021-05-2  NaN\n",
       "9   2021-05-1  NaN\n",
       "10  2021-04-0  NaN\n",
       "11  2021-03-2  NaN\n",
       "12  2021-03-1  NaN\n",
       "13  2021-03-0  NaN\n",
       "14  2021-02-2  NaN\n",
       "15  2021-02-0  NaN\n",
       "16  2021-01-2  NaN\n",
       "17  2021-01-0  NaN\n",
       "18  2020-12-3  NaN"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "test=pd.DataFrame()\n",
    "test['date']=''\n",
    "test['sum']=int(0)\n",
    "test\n",
    "for i in range(0,len(time)):\n",
    "    test.loc[i,'date']=time[i]\n",
    "test"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>date</th>\n",
       "      <th>sum</th>\n",
       "      <th>positive</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2021-08-1</td>\n",
       "      <td>8</td>\n",
       "      <td>8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2021-08-0</td>\n",
       "      <td>40</td>\n",
       "      <td>26</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2021-07-3</td>\n",
       "      <td>42</td>\n",
       "      <td>28</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2021-07-2</td>\n",
       "      <td>58</td>\n",
       "      <td>36</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2021-07-1</td>\n",
       "      <td>63</td>\n",
       "      <td>39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>2021-07-0</td>\n",
       "      <td>70</td>\n",
       "      <td>42</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>2021-06-1</td>\n",
       "      <td>71</td>\n",
       "      <td>41</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>2021-06-0</td>\n",
       "      <td>73</td>\n",
       "      <td>41</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>2021-05-2</td>\n",
       "      <td>76</td>\n",
       "      <td>44</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>2021-05-1</td>\n",
       "      <td>78</td>\n",
       "      <td>46</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>2021-04-0</td>\n",
       "      <td>79</td>\n",
       "      <td>47</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>2021-03-2</td>\n",
       "      <td>80</td>\n",
       "      <td>48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>2021-03-1</td>\n",
       "      <td>81</td>\n",
       "      <td>49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>2021-03-0</td>\n",
       "      <td>82</td>\n",
       "      <td>50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>2021-02-2</td>\n",
       "      <td>84</td>\n",
       "      <td>48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>2021-02-0</td>\n",
       "      <td>86</td>\n",
       "      <td>48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>2021-01-2</td>\n",
       "      <td>89</td>\n",
       "      <td>49</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>2021-01-0</td>\n",
       "      <td>97</td>\n",
       "      <td>45</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>2020-12-3</td>\n",
       "      <td>100</td>\n",
       "      <td>46</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         date  sum  positive\n",
       "0   2021-08-1    8         8\n",
       "1   2021-08-0   40        26\n",
       "2   2021-07-3   42        28\n",
       "3   2021-07-2   58        36\n",
       "4   2021-07-1   63        39\n",
       "5   2021-07-0   70        42\n",
       "6   2021-06-1   71        41\n",
       "7   2021-06-0   73        41\n",
       "8   2021-05-2   76        44\n",
       "9   2021-05-1   78        46\n",
       "10  2021-04-0   79        47\n",
       "11  2021-03-2   80        48\n",
       "12  2021-03-1   81        49\n",
       "13  2021-03-0   82        50\n",
       "14  2021-02-2   84        48\n",
       "15  2021-02-0   86        48\n",
       "16  2021-01-2   89        49\n",
       "17  2021-01-0   97        45\n",
       "18  2020-12-3  100        46"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data1=pd.read_csv(\"end1.csv\")\n",
    "data1.loc[199,'date']\n",
    "test['sum']=0\n",
    "test['positive']=0\n",
    "for j in range(0,len(time)):\n",
    "    for i in range(0,100):\n",
    "        if test.loc[j,'date']<result.loc[i,'时间']:\n",
    "            test.loc[j,'positive']+=int(result.loc[i,'结果'])\n",
    "            test.loc[j,'sum']+=1\n",
    "test"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [],
   "source": [
    "data=pd.read_csv(\"end2.csv\")\n",
    "data['%']=0\n",
    "for i in range(0,len(time)):\n",
    "    data.loc[i,'%']=data.loc[i,'positive']/data.loc[i,'sum']\n",
    "data.to_csv(\"end2.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['2021-08-1',\n",
       " '2021-08-0',\n",
       " '2021-07-3',\n",
       " '2021-07-2',\n",
       " '2021-07-1',\n",
       " '2021-07-0',\n",
       " '2021-06-1',\n",
       " '2021-06-0',\n",
       " '2021-05-2',\n",
       " '2021-05-1',\n",
       " '2021-04-0',\n",
       " '2021-03-2',\n",
       " '2021-03-1',\n",
       " '2021-03-0',\n",
       " '2021-02-2',\n",
       " '2021-02-0',\n",
       " '2021-01-2',\n",
       " '2021-01-0',\n",
       " '2020-12-3']"
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
